package cn.xaut.ocr3.config;

import io.github.mymonstercat.Model;
import io.github.mymonstercat.ocr.InferenceEngine;
import io.github.mymonstercat.ocr.config.ParamConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OcrEngineConfig {
    @Bean
    public InferenceEngine inferenceEngine() {
        // 单例引擎，全局使用
        return InferenceEngine.getInstance(Model.ONNX_PPOCR_V4);
    }
    @Bean
    public ParamConfig inferenceParam() {
        ParamConfig paramConfig = ParamConfig.getDefaultConfig();
        paramConfig.setDoAngle(true);
        paramConfig.setMostAngle(true);
        paramConfig.setPadding(20);
        paramConfig.setMaxSideLen(1024);
        return paramConfig;
    }
}
